using System;
using Holoville.HOTween;
using UnityEngine;

public class UButtonScale : UButton
{
	private void OnDisable()
	{
		if (this.IsTweening())
		{
			HOTween.Kill(this.tweener);
			this.tweener = null;
		}
		base.transform.localScale = this.orgScale;
	}

	protected override void Initialize()
	{
		this.orgScale = base.transform.localScale;
	}

	protected override void OnHoverOver()
	{
		if (this.IsTweening())
		{
			HOTween.Kill(this.tweener);
			this.tweener = null;
		}
		if (base.transform.localScale != this.hoverScale)
		{
			TweenParms tweenParms = new TweenParms().Prop("localScale", this.hoverScale);
			tweenParms.OnComplete(delegate()
			{
				this.tweener = null;
			});
			this.tweener = HOTween.To(base.transform, this.tweenDuration, tweenParms);
		}
	}

	protected override void OnHoverOut()
	{
		if (this.IsTweening())
		{
			HOTween.Kill(this.tweener);
			this.tweener = null;
		}
		if (base.transform.localScale != this.orgScale)
		{
			TweenParms tweenParms = new TweenParms().Prop("localScale", this.orgScale);
			tweenParms.OnComplete(delegate()
			{
				this.tweener = null;
			});
			this.tweener = HOTween.To(base.transform, this.tweenDuration, tweenParms);
		}
	}

	private bool IsTweening()
	{
		return this.tweener != null && !this.tweener.destroyed;
	}

	private Tweener tweener;

	private Vector3 orgScale;

	public Vector3 hoverScale = Vector3.one * 1.1f;

	public float tweenDuration = 0.1f;
}
